<template>
  <div>
    <h3>管理员列表</h3>
    <!--分割线-->
    <el-divider></el-divider>
    <!-- 卡片视图区 -->
    <el-card class="box-card">

      <!-- 用户列表区域 -->
      <el-table :data="userlist" border stripe>
        <el-table-column type="index"></el-table-column>
        <el-table-column label="管理员ID" prop="username"></el-table-column>
        <el-table-column label="角色id" prop="nickname" ></el-table-column>
        <el-table-column label="操作" width="200">
          <template slot-scope="scope">
            <!-- 修改按钮 -->
            <el-button type="primary" icon="el-icon-edit" size="mini"></el-button>
            <!-- 删除按钮 -->
            <el-button type="primary" icon="el-icon-delete" size="mini"></el-button>
          </template>
        </el-table-column>
      </el-table>

    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      userlist:[{
        username:'啊哈哈',
        nickname:'诶嘿嘿'
      }],
      // 获取用户列表参数对象
      // queryInfo: {
      //   query: '',
      //   pagenum:1,
      //   pagesize: 2
      // },
      // userlist:[],
      // total: 0
    }
  },
  created() {
    this.getUserList()
  },
  methods: {
    async getUserList() {
      const { data:res } = await this.$http.get('users',{ params: this.queryInfo })
      if (res.meta.status !==200 ){
        return this.$message.error('获取用户列表失败!')
      }
      this.userlist = res.data.users
      this.total = res.data.total
      console.log(res)
    }
  }
}
</script>

<style scoped>

</style>